import { defineStore } from "pinia"
import { computed, ref } from "vue"
import type {User} from '@/type/user'
export const useUserStore = defineStore('user', () => {
    const nameList:string[] = ['zs','ls','ww','ll','xm']
    const info = ref<User>({name:''})
    const nickName = computed(() => {
        return info.value.name||'游客'
    })
    function changeName() {
        const name = nameList[Math.floor(Math.random() * 5)]
        info.value.name = name
    }
    return {info,nickName,changeName}
})